import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path:"/",
    name:"Index",
    redirect:"/home"
  },
  {
    path: '/home',
    name: 'Home',
    component: Home,
    redirect: '/Home/HomePage',  // 重定向:重新指向其它path,会改变网址
    children:[
      {
        path: 'cash',
        name: 'Cash',
        component: () => import(/* webpackChunkName: "about" */ '../views/Home/Cash.vue')
      },
      {
        path: 'chat',
        name: 'Chat',
        component: () => import(/* webpackChunkName: "about" */ '../views/Home/Chat.vue')
      },
      {
        path: 'live',
        name: 'Live',
        component: () => import(/* webpackChunkName: "about" */ '../views/Home/Live.vue')
      },
      {
        path: 'personal',
        name: 'Personal',
        component: () => import(/* webpackChunkName: "about" */ '../views/Home/Personal.vue')
      },
      {
        path: 'homePage',
        name: 'HomePage',
        component: () => import(/* webpackChunkName: "about" */ '../views/Home/HomePage.vue')
      },
    ]
  },
  {
    path: '/address',
    name: 'Address',
    component: () => import(/* webpackChunkName: "about" */ '../views/Address.vue')
  },
  {
    path: '/goods',
    name: 'Goods',
    component: () => import(/* webpackChunkName: "about" */ '../views/Goods.vue')
  },
  {
    path: '/goodsDetail',
    name: 'GoodsDetail',
    component: () => import(/* webpackChunkName: "about" */ '../views/GoodsDetail.vue')
  },
  {
    path: '/search',
    name: 'Search',
    component: () => import(/* webpackChunkName: "about" */ '../views/Search.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
